/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JDialogSugeries.java
 *
 * Created on 14/09/2010, 23:11:57
 */
package systole.view.crud.patient.patientComponents.sugeries;

import java.awt.Font;
import javax.swing.JFormattedTextField;
import org.jdesktop.application.Action;

/**
 *
 * @author jmj
 */
public class JDialogSugeries extends javax.swing.JDialog {

    /**
     *
     */
    private static final long serialVersionUID = 9083525845907956719L;
    private ControllerEditionSugeryByPatient controller;

    /** Creates new form JDialogSugeries
     * @param parent  
     * @param controller
     * */
    public JDialogSugeries(java.awt.Frame parent, ControllerEditionSugeryByPatient controller) {
        super(parent, true);
        initComponents();
        this.controller = controller;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPnlCenter = new javax.swing.JPanel();
        lblSurgery = new javax.swing.JLabel();
        cmbSurgeries = new javax.swing.JComboBox();
        lblAgeAtSurgery = new javax.swing.JLabel();
        lblObservations = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtAreaObservations = new javax.swing.JTextArea();
        jTxtAge = new javax.swing.JFormattedTextField();
        jPnlBottom = new javax.swing.JPanel();
        jBtnOk = new javax.swing.JButton();
        jBtnCancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setModal(true);
        setName("Form"); // NOI18N
        setResizable(false);

        jPnlCenter.setName("jPnlCenter"); // NOI18N
        jPnlCenter.setPreferredSize(new java.awt.Dimension(390, 164));

        lblSurgery.setFont(lblSurgery.getFont().deriveFont(lblSurgery.getFont().getStyle() | java.awt.Font.BOLD));
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JDialogSugeries.class);
        lblSurgery.setText(resourceMap.getString("lblSurgery.text")); // NOI18N
        lblSurgery.setName("lblSurgery"); // NOI18N

        cmbSurgeries.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbSurgeries.setToolTipText(resourceMap.getString("cmbSurgeries.toolTipText")); // NOI18N
        cmbSurgeries.setName("cmbSurgeries"); // NOI18N

        lblAgeAtSurgery.setFont(lblAgeAtSurgery.getFont().deriveFont(lblAgeAtSurgery.getFont().getStyle() | java.awt.Font.BOLD));
        lblAgeAtSurgery.setText(resourceMap.getString("lblAgeAtSurgery.text")); // NOI18N
        lblAgeAtSurgery.setName("lblAgeAtSurgery"); // NOI18N

        lblObservations.setText(resourceMap.getString("lblObservations.text")); // NOI18N
        lblObservations.setName("lblObservations"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        txtAreaObservations.setColumns(20);
        txtAreaObservations.setLineWrap(true);
        txtAreaObservations.setRows(4);
        txtAreaObservations.setWrapStyleWord(true);
        txtAreaObservations.setName("txtAreaObservations"); // NOI18N
        jScrollPane2.setViewportView(txtAreaObservations);

        jTxtAge.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        jTxtAge.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTxtAge.setText(resourceMap.getString("jTxtAge.text")); // NOI18N
        jTxtAge.setToolTipText(resourceMap.getString("jTxtAge.toolTipText")); // NOI18N
        jTxtAge.setName("jTxtAge"); // NOI18N

        javax.swing.GroupLayout jPnlCenterLayout = new javax.swing.GroupLayout(jPnlCenter);
        jPnlCenter.setLayout(jPnlCenterLayout);
        jPnlCenterLayout.setHorizontalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblObservations)
                    .addComponent(lblAgeAtSurgery)
                    .addComponent(lblSurgery))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTxtAge, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
                    .addComponent(cmbSurgeries, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(28, Short.MAX_VALUE))
        );
        jPnlCenterLayout.setVerticalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbSurgeries, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblSurgery))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTxtAge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblAgeAtSurgery))
                .addGap(7, 7, 7)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblObservations)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(17, Short.MAX_VALUE))
        );

        getContentPane().add(jPnlCenter, java.awt.BorderLayout.CENTER);

        jPnlBottom.setName("jPnlBottom"); // NOI18N
        jPnlBottom.setPreferredSize(new java.awt.Dimension(340, 40));

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getActionMap(JDialogSugeries.class, this);
        jBtnOk.setAction(actionMap.get("ok")); // NOI18N
        jBtnOk.setText(resourceMap.getString("jBtnOk.text")); // NOI18N
        jBtnOk.setToolTipText(resourceMap.getString("jBtnOk.toolTipText")); // NOI18N
        jBtnOk.setName("jBtnOk"); // NOI18N
        jPnlBottom.add(jBtnOk);

        jBtnCancel.setAction(actionMap.get("cancel")); // NOI18N
        jBtnCancel.setText(resourceMap.getString("jBtnCancel.text")); // NOI18N
        jBtnCancel.setToolTipText(resourceMap.getString("jBtnCancel.toolTipText")); // NOI18N
        jBtnCancel.setName("jBtnCancel"); // NOI18N
        jPnlBottom.add(jBtnCancel);

        getContentPane().add(jPnlBottom, java.awt.BorderLayout.SOUTH);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox cmbSurgeries;
    private javax.swing.JButton jBtnCancel;
    private javax.swing.JButton jBtnOk;
    private javax.swing.JPanel jPnlBottom;
    private javax.swing.JPanel jPnlCenter;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JFormattedTextField jTxtAge;
    private javax.swing.JLabel lblAgeAtSurgery;
    private javax.swing.JLabel lblObservations;
    private javax.swing.JLabel lblSurgery;
    private javax.swing.JTextArea txtAreaObservations;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the txtAreaObservations
     */
    public javax.swing.JTextArea getTxtAreaObservations() {
        return this.txtAreaObservations;
    }

    /**
     * @return the cmbSurgeries
     */
    public javax.swing.JComboBox getCmbSurgeries() {
        return this.cmbSurgeries;
    }

    public JFormattedTextField getjTxtAge() {
        return jTxtAge;
    }

    /**
     * Confirm operation
     */
    @Action
    public void ok() {
        this.controller.ok();
    }

    /**
     * Cancel operation
     */
    @Action
    public void cancel() {
        this.controller.cancel();
    }
}
